package com.cskaoyan.controller;


import com.cskaoyan.bo.OrderShipBO;
import com.cskaoyan.service.OrderService;
import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.vo.OrderDetaliVO;
import com.cskaoyan.vo.OrderListVO;
import com.cskaoyan.vo.OrderVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class OrderController {


    @Autowired
    OrderService orderService;
    @RequestMapping("admin/order/list")
    public BaseRespVo list(Integer page ,Integer limit,String sort,String order ,Integer userId,Integer[]orderStatusArray,String orderSn){
        OrderListVO orderListVO = orderService.getlist(page,limit,sort,order,userId,orderStatusArray,orderSn);
        return BaseRespVo.ok(orderListVO);
    }

    @RequestMapping("admin/order/detail")
    public BaseRespVo queryOrderDetail(Integer id){
        OrderDetaliVO orderDetaliVO = orderService.queryOrderDetail(id);
        return BaseRespVo.ok(orderDetaliVO);

    }

    @RequestMapping("admin/order/refund")
    public BaseRespVo refund(Integer orderId,Integer refundMoney){
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrmsg("订单退款失败");
        baseRespVo.setErrno(621);
        return baseRespVo;
    }
    @RequestMapping("admin/order/ship")
    public BaseRespVo ship(@RequestBody OrderShipBO orderShipBO){
        orderService.ship(orderShipBO);
        return BaseRespVo.ok();
    }
}
